version: '2.2'
services:
  elasticsearch1:
    cap_add:
      - IPC_LOCK
    image: "{{docker_image}}:{{es_version}}"
    labels:
      io.rally.description: "elasticsearch-rally"
    {%- if docker_cpu_count is defined %}
    cpu_count: {{docker_cpu_count}}
    {%- endif %}
    {%- if docker_mem_limit is defined %}
    mem_limit: {{docker_mem_limit}}
    {%- endif %}
    ports:
      - {{http_port}}:{{http_port}}
      - 9300
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - {{es_data_dir}}:/usr/share/elasticsearch/data
      - {{es_log_dir}}:/var/log/elasticsearch
      - {{es_heap_dump_dir}}:/usr/share/elasticsearch/heapdump
{%- for host_path, docker_path in mounts.items() %}
      - {{host_path}}:{{docker_path}}
{%- endfor %}
    healthcheck:
      test: nc -z 127.0.0.1 {{http_port}}
      interval: 5s
      timeout: 2s
      retries: 10
